<template>
    <view class="content">
        <view class="heider_box">
            <view class="img_box"></view>
            <view class="header_top_box">
                <view class="top_txt" v-if="userInfo.parent_id > 0">已绑定：{{ userInfo.parent_id }}</view>
                <view class="top_txt" v-else>未绑定</view>
                <view class="bot_txt">
                    <view class="touxiangbufen">
                        <view class="touxiangKuang">
                            <image class="touxiangkuang_img" :src="userInfo.parent_frameless_head" mode="scaleToFill" />
                            
                        </view>
                        <view class="touxiang">
                                <image class="touxiang_img" :src="userInfo.parent_avatar" mode="scaleToFill" />
                            </view>
                    </view>
                    <view class="txt">{{ userInfo.parent_nickname }}</view>
                </view>
            </view>
        </view>
        <view class="two_box">
            <view class="yaoqingma">我的邀请码：{{ userInfo.user_id }}
            </view>
            <view class="quyaoqing" @tap="fuzhiyq">去邀请</view>
        </view>
        <!-- 说明 -->
        <view class="three_sm_box">
            <view class="title1_box">
                <image src="https://mh.qingfentool.vip/upload/image/20230327/af5a2c0ef117e2c52c8f1faf43b0ddde.png"
                    mode="scaleToFill" />
            </view>
            <view class="wenzi_box" v-html="userInfo.content">
            </view>
        </view>
        <!-- 邀请记录 -->
        <view class="jilu_box">
            <view class="title_box">
                <image src="https://mh.qingfentool.vip/upload/image/20230324/7818af2ef6020ec5ebe139326e84ae78.png"
                    mode="scaleToFill" />
            </view>
            <view class="biaotou_box">
                <view class="user">用户</view>
                <view class="time">注册时间</view>
                <view class="xiaofei">本月消费</view>
            </view>
            <scroll-view scroll-y="true" class="huadong_box">
                <view class="yaoqing_con" v-for="(item, index) in userList" :key="index">
                    <view class="user_con">{{ item.nickname }}</view>
                    <view class="time_con">{{ item.register_time | formatDate('-') }}</view>
                    <view class="xiaofei_con">{{ item.total_price }}</view>
                </view>
            </scroll-view>
        </view>
    </view>
</template>
<script>
export default {
    data() {
        return {
            userList: [],
            userInfo: {},
        }
    },
    onShow() {
        this.init()
    },
    filters: {
        // 时间戳处理
        formatDate: function (value, spe = '/') {
            value = value * 1000
            let data = new Date(value);
            let year = data.getFullYear();
            let month = data.getMonth() + 1;
            let day = data.getDate();
            let h = data.getHours();
            let mm = data.getMinutes();
            let s = data.getSeconds();
            month = month >= 10 ? month : "0" + month;
            day = day >= 10 ? day : "0" + day;
            h = h >= 10 ? h : "0" + h;
            mm = mm >= 10 ? mm : "0" + mm;
            return `${year}${spe}${month}${spe}${day} ${h}:${mm}`;
        }
    },
    methods: {
        fuzhiyq() {
            let data = String(this.userInfo.user_id)
            uni.setClipboardData({
                data,
                success: () => {
                    this.$u.toast('复制成功~')
                }
            });
        },
        init() {
            this.$Request.post(this.$api.user.myInvite).then(res => {
                // ////console.log(res, "paihangh")
                this.userInfo = res.data
                // ////console.log("this.userInfo:", this.userInfo)
                this.userList = res.data.list
                // ////console.log("this.userList:", this.userList)
            })
        },
    }
}
</script>
<style lang="scss" scoped>
.content {
    min-height: 100vh;
    width: 100%;
    padding: 15rpx 0 0 0;
    background: linear-gradient(139deg, #3FC4F9 0%, #B6FAFF 66%, #D776FD 100%);

    .heider_box {
        height: 410rpx;
        width: 96%;
        margin: auto;
        position: relative;
        margin-bottom: 22rpx;

        .img_box {
            width: 472rpx;
            height: 424rpx;
            background-image: url('https://mh.qingfentool.vip/upload/image/20230324/6c43e887f7d18a2ef155ecf9e757201a.png');
            background-size: 100% 100%;
            margin: auto;
        }

        .header_top_box {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 250rpx;
            background-color: #fff;
            border-radius: 24rpx 24rpx 24rpx 24rpx;
            padding-top: 28rpx;
            padding-bottom: 30rpx;

            .top_txt {
                width: 100%;
                height: 58rpx;
                text-align: center;
                font-size: 40rpx;
                font-family: Source Han Sans CN-Bold, Source Han Sans CN;
                font-weight: 700;
                color: #3D3D3D;
                line-height: 58rpx;
                margin-bottom: 30rpx;
            }

            .bot_txt {
                width: 100%;
                height: 106rpx;
                display: flex;
                justify-content: center;
                align-items: center;
                line-height: 74rpx;

                .touxiangbufen {
                    width: 100rpx;
                    height: 90rpx;
                    position: relative;
                    margin-right: 10rpx;

                    .touxiangKuang {
                        width: 100%;
                        height: 100%;
                        // background-color: aqua;
                        border-radius: 50%;
                        z-index: 999;
                        position: absolute;
                        left: 0;
                        right: 0;
                        top: 0;
                        bottom: 0;
                        margin: auto;

                        .touxiangkuang_img {
                            width: 100%;
                            height: 100%;
                            border-radius: 50%;
                            // z-index: 999;
                        }
                    }

                    .touxiang {
                        width: 74rpx;
                        height: 74rpx;
                        border-radius: 50%;
                        position: absolute;
                        left: 0;
                        right: 0;
                        top: 0;
                        bottom: 0;
                        margin: auto;
                        z-index: 1;

                        .touxiang_img {
                            width: 100%;
                            height: 100%;
                            border-radius: 50%;
                            z-index: 1;
                        }
                    }
                }


                .txt {
                    font-size: 32rpx;
                    font-family: Source Han Sans CN-Medium, Source Han Sans CN;
                    font-weight: 800;
                    color: #3D3D3D;
                    line-height: 46rpx;
                }
            }
        }
    }

    .two_box {
        height: 252rpx;
        width: 96%;
        border-radius: 24rpx 24rpx 24rpx 24rpx;
        margin: auto;
        background-image: url('https://mh.qingfentool.vip/upload/image/20230324/dc30cea9f479614647289df8973a1c1a.png');
        background-size: 100% 100%;
        position: relative;
        margin-bottom: 22rpx;

        .yaoqingma {
            position: absolute;
            width: 100%;
            height: 46rpx;
            line-height: 46rpx;
            font-size: 32rpx;
            color: #3D3D3D;
            text-align: center;
            font-weight: 500;
            top: 50%;
            transform: translate(0, -50%);
        }

        .quyaoqing {
            position: absolute;
            width: 260rpx;
            height: 60rpx;
            bottom: 20rpx;
            left: 50%;
            transform: translate(-50%, 0);
            background: linear-gradient(180deg, #80CBFF 0%, #6550FF 100%);
            box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(0, 0, 0, 0.2);
            border-radius: 42rpx 42rpx 42rpx 42rpx;
            font-size: 34rpx;
            font-family: Source Han Sans CN-Medium, Source Han Sans CN;
            font-weight: 700;
            color: #FFFFFF;
            line-height: 60rpx;
            text-align: center;
        }
    }

    .three_sm_box {
        width: 96%;
        background-size: 100% 100%;
        background-image: url('https://mh.qingfentool.vip/upload/image/20230327/8f2659add126639a109db2421352b937.png');
        margin: auto;
        margin-bottom: 22rpx;

        // padding-top: 86rpx;
        .title1_box {
            width: 326rpx;
            height: 76rpx;
            margin: auto;
            margin-bottom: 26rpx;

            image {
                width: 100%;
                height: 100%;
            }
        }

        .wenzi_box {
            width: 96%;
            margin: auto;
            font-size: 24rpx;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 400;
            color: #666666;
            padding-bottom: 20rpx;
        }
    }

    .jilu_box {
        position: relative;
        width: 96%;
        height: 624rpx;
        margin: auto;
        background-color: #F6FEFF;
        border-radius: 24rpx 24rpx 24rpx 24rpx;

        .title_box {
            width: 326rpx;
            height: 76rpx;
            margin: auto;
            margin-bottom: 26rpx;

            image {
                width: 100%;
                height: 100%;
            }
        }

        .biaotou_box {
            width: 96%;
            height: 54rpx;
            margin: auto;
            border-radius: 8rpx 8rpx 8rpx 8rpx;
            line-height: 54rpx;
            background: rgba(186, 229, 255, 0.2);
            display: flex;
            justify-content: space-between;

            .user,
            .time,
            .xiaofei {
                text-align: center;
                width: 33%;
                height: 100%;
                font-size: 28rpx;
                font-family: Source Han Sans CN-Bold, Source Han Sans CN;
                font-weight: 700;
                color: #333333;
            }
        }

        .huadong_box {
            position: absolute;
            width: 96%;
            height: 450rpx;
            bottom: 0;
            margin: auto;

            .yaoqing_con {
                width: 100%;
                height: 34rpx;
                margin: auto;
                border-radius: 8rpx 8rpx 8rpx 8rpx;
                line-height: 34rpx;
                background: #F6FEFF;
                display: flex;
                color: #666666;
                justify-content: space-between;

                .user_con,
                .time_con,
                .xiaofei_con {
                    text-align: center;
                    width: 33%;
                    height: 100%;
                    font-size: 28rpx;
                    font-family: Source Han Sans CN-Bold, Source Han Sans CN;
                    font-weight: 700;
                    color: #333333;
                }
            }
        }

    }
}
</style>